import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:palmf_hid/common/values/my_color.dart';
import 'package:palmf_hid/pages/main/disposition/clinical_symptom_setting/clinical_symptom_setting_view.dart';
import 'package:palmf_hid/pages/main/disposition/project_setting/project_setting_view.dart';
import 'package:palmf_hid/pages/main/disposition/user_setting/user_setting_view.dart';
import 'package:tab_container/tab_container.dart';

import 'diagnostic_conclusion_setting/diagnostic_conclusion_setting_view.dart';
import 'disposition_logic.dart';
import 'disposition_state.dart';

class DispositionPage extends StatefulWidget {
  const DispositionPage({Key? key}) : super(key: key);

  @override
  State<DispositionPage> createState() => _DispositionPageState();
}

class _DispositionPageState extends State<DispositionPage> {
  final DispositionLogic logic = Get.put(DispositionLogic());
  final DispositionState state = Get.find<DispositionLogic>().state;

  @override
  Widget build(BuildContext context) {
    return _buildBody();
  }

  _buildBody() {
    return Container(
      child: TabContainer(
        controller: logic.tabController,
        tabEdge: TabEdge.top,
        tabsStart: 0,
        tabsEnd: 0.9,
        tabMaxLength: 100,
        borderRadius: BorderRadius.circular(10),
        tabBorderRadius: BorderRadius.circular(10),
        childPadding: const EdgeInsets.all(20.0),
        selectedTextStyle: const TextStyle(
          color: MyColor.account_color,
          fontSize: 15.0,
        ),
        unselectedTextStyle: const TextStyle(
          color: MyColor.c_99000000,
          fontSize: 13.0,
        ),
        colors: const [
          Colors.white,
          Colors.white,
          Colors.white,
          Colors.white,
        ],
        tabs: logic.tabs.map((res) {
          return Tab(
            text: res,
          );
        }).toList(),
        children: const [
          ClinicalSymptomSettingPage(),
          DiagnosticConclusionSettingPage(),
          ProjectSettingPage(),
          UserSettingPage(),
        ],
      ),
    );
  }

  @override
  void dispose() {
    Get.delete<DispositionLogic>();
    super.dispose();
  }
}
